﻿@model Treinamento2015_01.Models.ProductViewModel

@{
    ViewBag.Title = Treinamento2015_01.Resources.General.Resource.Create;
}
@Styles.Render("~/Content/Productcss.css")
<script type="text/javascript" src="~/Scripts/CurrencyFormatter.js"></script>
<h2>@Treinamento2015_01.Resources.General.Resource.Create</h2>
@using (Html.BeginForm("Create", "Product", FormMethod.Post, new { id = "signupform" }))
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>@Treinamento2015_01.Resources.Product.ResourceProduct.CreateTitle</h4>
        <hr />
        @Html.ValidationSummary(true)

        <div class="form-group">
            @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.Name)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.ManufacturerId, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownList("ManufacturerId", (IEnumerable<SelectListItem>)ViewBag.ManufacturerId, Treinamento2015_01.Resources.General.Resource.Select, htmlAttributes: new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.ManufacturerId)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBoxFor(model => model.Price, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.Price)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.ProductType, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @foreach (var item in ViewBag.TypeList)
                {
                    <div class="col-md-2">
                        <a href="#" class="thumbnail typeitem" id="type-@item.Id">
                            <input type="radio" name="ProductTypeId" value="@item.Id" hidden><img class="TypeImage" src="@Url.Content(item.ImageUrl)"><div class="text-center">@item.Name</div>
                        </a>
                    </div>

                }
                <span id="message"><font color="red">@Treinamento2015_01.Resources.Product.ResourceProduct.ProductTypeAlert</font></span>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="@Treinamento2015_01.Resources.General.Resource.Create" class="btn btn-default" />
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink(Treinamento2015_01.Resources.General.Resource.BackToList, "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval"),
@Scripts.Render("~/Scripts/CheckBoxImages.js")
}
